Use `char` when using single character as `Pattern`.
authorCorey Farwell <coreyf@rwell.org>
Sat, 6 Aug 2016 02:31:19 +0000 (22:31 -0400)
committerCorey Farwell <coreyf@rwell.org>
Sat, 6 Aug 2016 02:31:19 +0000 (22:31 -0400)
src/cargo/sources/git/source.rs
src/cargo/sources/path.rs
src/cargo/sources/registry/index.rs
src/cargo/util/config.rs
src/cargo/util/toml.rs

index 20118821c20252cf1ce0f6aa5776950c33fd46b9..c2254aa976e523e78dae2ec14a4941a834736e3a 100644 (file)
@@ -79,7 +79,7 @@ pub fn canonicalize_url(url: &Url) -> Url {
     let mut url = url.clone();
 
     // Strip a trailing slash
-    if url.path().ends_with("/") {
+    if url.path().ends_with('/') {
         url.path_segments_mut().unwrap().pop_if_empty();
     }
 
index 6ae4cdf1a30bc7cd8e72263382df17d3855b8b21..052d01c7dab0c755efe172975f6c0d6e5c3ef875 100644 (file)
@@ -288,7 +288,7 @@ impl<'cfg> PathSource<'cfg> {
             let dir = try!(dir).path();
             let name = dir.file_name().and_then(|s| s.to_str());
             // Skip dotfile directories
-            if name.map(|s| s.starts_with(".")) == Some(true) {
+            if name.map(|s| s.starts_with('.')) == Some(true) {
                 continue
             } else if is_root {
                 // Skip cargo artifacts
index 7be0a309c65eed9eb609e1a6f69a122372b38af8..5f27b4b2a4f8b36cafc46309b270c160158fe68a 100644 (file)
@@ -180,7 +180,7 @@ impl<'cfg> Registry for RegistryIndex<'cfg> {
         summaries.retain(|s| {
             match self.source_id.precise() {
                 Some(p) if p.starts_with(dep.name()) &&
-                           p[dep.name().len()..].starts_with("=") => {
+                           p[dep.name().len()..].starts_with('=') => {
                     let vers = &p[dep.name().len() + 1..];
                     s.version().to_string() == vers
                 }
index 43721f016db4aa16b85e3bf03f4091f96c343589..df319125d83a8a88d2720b5eeea8cdfb84344702 100644 (file)
@@ -197,8 +197,8 @@ impl Config {
 
     pub fn get_path(&self, key: &str) -> CargoResult<Option<Value<PathBuf>>> {
         if let Some(val) = try!(self.get_string(&key)) {
-            let is_path = val.val.contains("/") ||
-                          (cfg!(windows) && val.val.contains("\\"));
+            let is_path = val.val.contains('/') ||
+                          (cfg!(windows) && val.val.contains('\\'));
             let path = if is_path {
                 val.definition.root(self).join(val.val)
             } else {
index 6fe9e285f0e311bb93dc5485044369fe0dc43550..7b805d51b837b4abbfb9fdd7fe722af27c713011 100644 (file)
@@ -93,7 +93,7 @@ fn try_add_files(files: &mut Vec<PathBuf>, root: PathBuf) {
                 // even valid UTF-8. Here we just ignore all of them and require
                 // that they are explicitly specified in Cargo.toml if desired.
                 f.file_name().and_then(|s| s.to_str()).map(|s| {
-                    !s.starts_with(".")
+                    !s.starts_with('.')
                 }).unwrap_or(true)
             }))
         }
@@ -925,7 +925,7 @@ impl TomlTarget {
             Some(ref name) => {
                 if name.trim().is_empty() {
                     Err(human("library target names cannot be empty.".to_string()))
-                } else if name.contains("-") {
+                } else if name.contains('-') {
                     Err(human(format!("library target names cannot contain hyphens: {}",
                                       name)))
                 } else {